﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;


namespace DataAccessLayer
{
    public class DataAccessLayer:IDisposable
    {

        #region Member Variables 

        private string m_szConnection = string.Empty;
        private int m_iCommandTimeout = 1;
        private Database m_oConnection = null;        

        #endregion

        #region Constructors 

        public DataAccessLayer()
        {

        }

        public DataAccessLayer(string szConnection)
        {

            
        }

        public DataAccessLayer(string szConnection, int iCommandTimeout)
        {

        }


        #endregion

        #region Properties 

        public string ConnectionString
        {
            set
            {
                if (value.Trim() == string.Empty)
                {
                    throw new Exception("Connection String cannot be empty");
                }
                m_szConnection = value;
            }
        }

        public int CommandTimeout
        {
            set
            {
                m_iCommandTimeout = value;
            }
        }


        #endregion

        public void GetDatabaseObject()
        {           

            
        }


        #region ExecuteQuery 

        public DataSet ExecuteQuery(string szQuery, string szTableName)
        {
            return m_oConnection.ExecuteQuery(szQuery, szTableName);
        }

        public  DataSet ExecuteQuery(string[] szQuery, string[] szTableName)
        {
            return m_oConnection.ExecuteQuery(szQuery, szTableName);
        }

        public  DataSet ExecuteQuery(string szQuery)
        {
            return m_oConnection.ExecuteQuery(szQuery);
        }

        public  DataSet ExecuteQuery(string[] szQuery)
        {
            return m_oConnection.ExecuteQuery(szQuery);
        }

        #endregion

        #region ExecuteScalar 

        public  object ExecuteScalar(string szQuery)
        {
            return m_oConnection.ExecuteScalar(szQuery);
        }

        #endregion

        #region ExecuteNonQuery 

        public  int ExecuteNonQuery(string szQuery)
        {
            return m_oConnection.ExecuteNonQuery(szQuery);
        }

        public  int ExecuteNonQuery(string[] szQuery)
        {
            return m_oConnection.ExecuteNonQuery(szQuery);
        }

        public  int ExecuteNonQuery(string[] szQuery, bool bTranasactionRequired)
        {
            return m_oConnection.ExecuteNonQuery(szQuery, bTranasactionRequired);
        }

        #endregion

        #region IDisposable Members 

        public void Dispose()
        {
            if (m_oConnection != null)
            {
                m_oConnection.Dispose();    
            }
        }

        #endregion

    }
}
